package servlets;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import sessionBeans.GestionContactGroupBeanEntity;
import sessionBeans.GestionContactGroupLocal;

/**
 * Servlet implementation class DeleteGroupServlet
 */
public class DeleteGroupServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@EJB(name = "ContactGroupBeanEntity", beanInterface = GestionContactGroupBeanEntity.class)
	GestionContactGroupLocal daoContactgroup;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		String grName = request.getParameter("nameGroup");

		daoContactgroup.delete(grName);
		RequestDispatcher dispatcher = request
				.getRequestDispatcher("SearchGroup");

		dispatcher.forward(request, response);

	}

}
